//
//  photoWallCell.m
//  HengHuaSupervision
//
//  Created by wanglong8889@126.com on 14-4-1.
//  Copyright (c) 2014年 XD-XY. All rights reserved.
//

#import "photoWallCell.h"

@implementation photoWallCell

- (id)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
    if (self) {
        // Initialization code
        UITapGestureRecognizer *tap1 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(goToPhotosDetail:)];
        
        UITapGestureRecognizer *tap2 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(goToPhotosDetail:)];
        
        UITapGestureRecognizer *tap3 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(goToPhotosDetail:)];
        
        UITapGestureRecognizer *tap4 = [[UITapGestureRecognizer alloc] initWithTarget:self action:@selector(goToPhotosDetail:)];
        
        self.pFirstView = [[pWallView alloc] initWithFrame:CGRectMake(0, 0, 225, 201)];
        _pFirstView.tag = 101;
        [_pFirstView addGestureRecognizer:tap1];
        
        self.pSecondView = [[pWallView alloc] initWithFrame:CGRectMake(_pFirstView.frame.origin.x+_pFirstView.frame.size.width+10, 0, 225, 201)];
        _pSecondView.tag = 102;
        [_pSecondView addGestureRecognizer:tap2];
        
        self.pThirdView = [[pWallView alloc] initWithFrame:CGRectMake(_pSecondView.frame.origin.x+_pSecondView.frame.size.width+10, 0, 225, 201)];
        _pSecondView.tag = 103;
        [_pThirdView addGestureRecognizer:tap3];
        
        self.pFourthView = [[pWallView alloc] initWithFrame:CGRectMake(_pThirdView.frame.origin.x+_pThirdView.frame.size.width+10, 0, 225, 201)];
        _pFourthView.tag = 104;
        [_pFourthView addGestureRecognizer:tap4];
        self.backgroundColor = [UIColor clearColor];
        
        [self.contentView addSubview:_pFirstView];
        [self.contentView addSubview:_pSecondView];
        [self.contentView addSubview:_pThirdView];
        [self.contentView addSubview:_pFourthView];
    }
    return self;
}
-(void)layoutSubviews{
    [super layoutSubviews];
    [_pFirstView initpWallView];
     [_pSecondView initpWallView];
     [_pThirdView initpWallView];
     [_pFourthView initpWallView];
}


-(void)goToPhotosDetail:(UITapGestureRecognizer *)sender{
    pWallView *pw = (pWallView *)sender.view;
    [_delegate goPhotos:pw.pWall];
    
}
- (void)setSelected:(BOOL)selected animated:(BOOL)animated
{
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
